<template>
    <div class="container" :style="'min-height: '+$docHeight+'px'">
        <div v-if="showCont&&!showTimeOut">
            <div class="cardCont">
                <div class="cardMain">
                    <div class="cardMoney">12.90</div>
                    <div class="cardMainDes">我的余额(元)</div>
                </div>
                <div class="cardCtrl">
                    <div class="cardCtrlItem hasRightBorder" @click="recordFn(1)">
                        <div class="iconfont icon-24gl-phoneLoudspeaker"></div>
                        <div>充值记录</div>
                    </div>
                    <div class="cardCtrlItem" @click="recordFn(2)">
                        <div class="iconfont icon-24gl-phoneLoudspeaker"></div>
                        <div>交易消费</div>
                    </div>
                </div>
            </div>
            <div class="mainCont">
                <div class="mainTitle">充值金额</div>
                <div class="stepCont">
                    <div @click="stepFn(item)" :class="index%3==0?'stepItem noLeft':'stepItem'" :key="index" v-for="(item,index) in stepArr">
                        <div :class="stepId==item.id?'stepMain stepActive':'stepMain'">
                            <div class="stepMoney">¥{{ item.money }}</div>
                            <div class="stepMoney2">
                                <div class="smallText">赠¥{{ item.money2 }}</div>
                            </div>
                        </div>
                    </div>
                </div>
                <div class="mainTitle">充值说明</div>
                <div class="desCont">
                    <div class="desItem" :key="index" v-for="(item,index) in desArr">
                        <div class="yuan"></div>
                        <div>{{ item.val }}</div>
                    </div>
                </div>
            </div>
            <div class="payBtn">确认充值</div>
        </div>
        <van-popup v-model:show="showRecord" round style="width: 80%;">
            <div class="formMain">
                <div class="recordTitle">{{ recordType==1?'充值':'交易' }}记录(5笔)</div>
                <div class="formCont" :key="index" v-for="(item,index) in 10">
                    <div class="itemForm">
                        <div class="formLeft">
                            <div class="formInput">
                                <div class="authVal">CZ12765783481</div>
                            </div>
                            <div class="formInput">
                                <div class="authVal">2024-06-31 11:30</div>
                            </div>
                        </div>
                        <div class="orderPricr" v-if="recordType==1">+ ¥15.00</div>
                        <div class="orderPricr redText" v-if="recordType==2">- ¥15.00</div>
                    </div>
                </div>
            </div>
        </van-popup>
    </div>
</template>
<script>
    export default {
        components: {},
        name:'',
        data() {
            return {
                showTimeOut: false,
                showCont:false,
                showRecord:false,
                recordType:1,
                stepArr:[
                    {money:'100',money2:'10',id:0},
                    {money:'200',money2:'22',id:1},
                    {money:'500',money2:'60',id:2},
                    {money:'1000',money2:'140',id:3},
                    {money:'2000',money2:'300',id:4},
                    {money:'5000',money2:'800',id:5},
                ],
                stepId:0,
                desArr:[
                    {val:'充值只可选择以上周定档位金额'},
                    {val:'充值金额无法提现,无法找零'},
                    {val:'充值金额可以使用积分兑换'},
                    {val:'充值金额永久有效'},
                ],
            }
        },
        props: {},
        setup(){},
        methods:{
            stepFn(item){
                this.stepId = item.id;
            },
            recordFn(type){
                this.recordType = type
                this.showRecord=  true
            }
        },
        mounted(){},
        created() {
            this.showCont = true
        },
    }
</script>
<style scoped lang="less">
.container{
    box-sizing: border-box;
    padding-top: 0.75rem;
    padding-bottom: 1.25rem;
    background-color: #ebf9f3;
    .cardCont{
        width: 92%;
        margin: 0 auto;
        background-color: #5cc78e;
        color: #fff;
        padding: 0.75rem;
        position: relative;
        z-index: 2;
        box-sizing: border-box;
        border-radius: 0.25rem;
        // box-shadow: 0 0 10px #5cc78e;
        .cardMain{
            text-align: center;
            .cardMoney{
                font-size: 1.5rem;
                margin-top: 0.75rem;
            }
            .cardMainDes{
                font-size: 0.6rem;
                color: #f7f7f7;
                margin-top: 0.25rem;
            }
        }
        .cardCtrl{
            display: flex;
            margin-top:1.25rem;
            align-items: center;
            font-size: 0.6rem;
            .cardCtrlItem{
                width: 50%;
                display: flex;
                justify-content: center;
                align-items: center;
                .iconfont{
                    margin-right: 0.25rem;
                }
            }
            .hasRightBorder{
                border-right: 1px solid #f7f7f7;
            }
        }
    }
    .mainCont{
        width: 92%;
        margin: 0.75rem auto;
        background-color: #fff;
        padding: 0.75rem 4% 0.75rem;
        box-sizing: border-box;
        border-radius: 0.25rem;
        margin-top: 0.75rem; 
        .mainTitle{
            font-size: 0.8rem;
            font-weight: bold;
        }
        .desCont{
            margin-top: 0.5rem;
            .desItem{
                display: flex;
                margin-bottom: 0.15rem;
                font-size: 0.6rem;
                color: #999;
                align-items: center;
                .yuan{
                    width: 0.4rem;
                    height: 0.4rem;
                    background-color: #5cc78e;
                    border-radius:50%;
                    margin-right: 0.25rem;
                }
            }
        }
        .stepCont{
            width: 100%;
            display: flex;
            margin-top: 0.75rem;
            flex-wrap: wrap;
            margin-bottom: 1.25rem;
            .stepItem{
                width: 30%;
                margin-left: 5%;
                .stepMain{
                    width: 100%;
                    padding:1.25rem 0;
                    overflow: hidden;
                    text-align: center;
                    border: 1px solid #5cc78e;
                    box-sizing: border-box;
                    background-color: #ebf9f3;
                    border-radius: 0.25rem;
                    position: relative;
                    margin-bottom: 0.75rem;
                    .stepMoney2{
                        position: absolute;
                        right: 0;
                        top: 0;
                        padding: 0 0.35rem;
                        font-size: 0.6rem;
                        background-color: #5cc78e;
                        border-radius:0 0 0 0.1rem;
                        color: #fff;
                        .smallText{
                            transform: scale(0.8);
                        }
                    }
                    .stepMoney{
                        color: #5cc78e;
                        font-size: 0.9rem;
                    }
                }
                .stepActive{
                    background-color: #5cc78e;
                    color: #fff;
                    .stepMoney{
                        color: #fff;
                    }
                    .stepMoney2{
                        background-color: #fff;
                        color: #5cc78e;
                    }
                }
            }
            .noLeft{
                margin-left: 0;
            }
        }
    }
    .payBtn{
        background-color: #5cc78e;
        color: #fff;
        border-radius: 0.25rem;
        width: 92%;
        margin: 1.75rem auto 0;
        text-align: center;
        line-height: 2.2rem;
    }
    .formMain{
        background-color: #fff;
        width: 92%;
        margin: 0 auto 0.75rem;
        position: relative;
        overflow: hidden;
        height: 20rem;
        overflow: auto;
        padding: 0.75rem 4%;
        border-radius: 0.25rem;
        box-sizing: border-box;  
        .recordTitle{
            font-size: 0.8rem;
            font-weight: bold;
            padding-bottom: 0.75rem;
            text-align: center;
        }
        .formCont{
            width: 100%;
            padding: 0.75rem 0;
            box-sizing: border-box;
            border-top: 1px dashed #ccc;
            .formTitle{
                font-weight: bold;
                font-size: 0.75rem;
                margin-bottom: 0.5rem;
            }
            .itemForm{
                display: flex;
                align-items: center;
                justify-content: space-between;
                .orderPricr{
                    color: #5cc78e;
                    font-size: 1rem;
                }
                .redText{
                    color: rgb(238, 80, 32);
                }
            }
            .formInput{
                display: flex;
                align-items: center;
                margin-bottom: 0.25rem;
                color: #666;
                // font-size: 0.6rem;
            }
            .formCtrl{
                margin-top: 0.75rem;
                display: flex;
                justify-content: flex-end;
                .ctrlItem{
                    padding: 0.35rem 1.5rem;
                    background-color: #fff;
                    color: #5cc78e;
                    margin-left: 0.75rem;
                    border-radius: 0.25rem;
                    font-size: 0.6rem;
                    border: 1px solid #5cc78e;
                }
                .delBtn{
                    background-color: #5cc78e;
                    color: #fff;
                }
            }
        }  
    }
    
}
</style>